package pattern.behavioral.chainofresponsibility;

import java.math.BigDecimal;

/**
 * @author: chaoyang.ren  
 * @date:Jun 6, 2017  
 * @time:11:27:26 AM   
 * @email:chaoyang.ren@foxmail.com  
 * @version: 1.0
 */
public class Test {
	public static void main(String[] args) {
		NumberHandler handler1 = new IntegerHandler();
		NumberHandler handler2 = new BigDecimalHandler();
		Number[] ns = {new Integer(2), BigDecimal.valueOf(1.3), Integer.valueOf(7), BigDecimal.valueOf(4.78)};
		HandlerChain hc = new HandlerChain();
		hc.addHandler(handler1);
		hc.addHandler(handler2);
		for (Number number : ns) {
			hc.handle(number);
		}
	}
}

